import React from "react";
import PropTypes from "prop-types";

/**
 *  Image Component
 */
export default class Image extends React.Component
{
    /**
     * 组件类名
     */
    className = "image";

    /**
     * 默认属性
     */
    static defaultProps =
    {
        width : "auto",
        height : "auto",
        src : "",
        alt : "image alt",
        style : {}
    };

    /**
     * 属性类型
     */
    static propTypes =
    {
        src : PropTypes.string.isRequired,
        alt : PropTypes.string,
        width : PropTypes.any,
        height : PropTypes.any,
        style : PropTypes.object
    };

    render ()
    {
        return <img alt={this.props.alt} {...this.props} className={this.className}/>;
    }
}